<?php
    
    mysql_connect('localhost','cms_bik','supercms');
    

    
    mysql_select_db("lifecms")
        or die(mysql_error());
    
    /*TWORZENIE TABELI UZYKOWNIKOW*/
    $query = "CREATE TABLE user (
        id int(11) NOT NULL auto_increment,
        login varchar(255) NOT NULL,
        password varchar(255) NOT NULL,
        hash varchar(25) NOT NULL,
        acc_status int(1) NOT NULL,
        activation_key varchar(255) NOT NULL,
        register_date datetime,
        PRIMARY KEY (id)    
    
    )";
    
    mysql_query($query)
    OR die(mysql_error());
    
    /*TWORZENIE TABELI ARTYKUŁÓW*/
    $query = "CREATE TABLE article (
        id int(11) NOT NULL auto_increment,
        autor_id int(11) NOT NULL,
        title text(65535),
        text text(65535),
        date datetime,
        category_id int(11),
        comment_status int(1),
        PRIMARY KEY (id) 
    )"; 
    
    mysql_query($query)
    OR die(mysql_error());
    
    
    
   /*TWORZENIE TABELI KOMENTARZY */
    $query = "CREATE TABLE comment (
        id int(11) NOT NULL auto_increment,
        article_id int(11) NOT NULL,
        user_id int(11) NOT NULL,
        comment text(65535) NOT NULL,
        date datetime,
        PRIMARY KEY (id)
    )";
    
    mysql_query($query)
    OR die(mysql_error());
    
    /*TWORZENIE TABELI OCENIANIA*/
    $query = "CREATE TABLE vote (
        id int(11) NOT NULL auto_increment,
        article_id int(11) NOT NULL,
        user_id int(11) NOT NULL,
        mark int(1) NOT NULL,
        PRIMARY KEY (id) 
    )";
    
    mysql_query($query)
    OR die(mysql_error());
    
    
    /*TWORZENIE TABELI KATEGORII*/
    $query = "CREATE TABLE category (
       id int(11) NOT NULL auto_increment,
       name varchar(255) NOT NULL,
       miniature text(65535),
       PRIMARY KEY (id)        
    )";
    
    mysql_query($query)
    OR die(mysql_error());
   
    
    /*TWORZENIE TABELI PODSTRON*/
    $query = "CREATE TABLE page (
        id int(11) NOT NULL auto_increment,
        name text(65535) NOT NULL,
        content text(65535) NOT NULL,
        show_on_menu int(1),
        PRIMARY KEY (id)
    )";    
    
    mysql_query($query)
    OR die(mysql_error());
    
     
     
     /*TWORZENIE TABELI WIADOMOŚCI*/
     $query = "CREATE TABLE message (
        id int(11) NOT NULL auto_increment,
        recpient int(11) NOT NULL,
        sender int(11) NOT NULL,
        title text(65535) NOT NULL,
        text text(65535) NOT NULL,
        date datetime,
        PRIMARY KEY (id)
     )";
     
     mysql_query($query)
     OR die(mysql_error());
     
    
    /*TWORZENIE TABELI INFORMACJI O UZYTKOWNIKU*/
    $query = "CREATE TABLE user_info (
        user_id int(11),
        mail varchar(255),
        city varchar(255),
        birth_date date
    )";
    
    mysql_query($query)
    OR die(mysql_error());
    
    
    /*TWORZENIE TABELI KONFIGURACYJNEJ*/
    $query = "CREATE TABLE configuration (
        id int(11) NOT NULL auto_increment,
        option_name varchar(255) NOT NULL,
        option_value int(11) NOT NULL,
        PRIMARY KEY (id)
    )";
    
    mysql_query($query)
    OR die(mysql_error());
    

?>